package com.dobby.logger.system.task;

import com.dobby.logger.utils.CommonUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * Created by liguoqing on 2016/3/7.
 */
@Component
public class AnnotationTask {

    private  static  final Logger logger = LoggerFactory.getLogger(AnnotationTask.class);

    @Scheduled(cron = "*/5 * * * * ?")
    private void work() {
        String status = CommonUtils.findProperties("task.properties").getProperty("status");
        if(status.equals("open")) {
            logger.info("=============》每隔5秒执行annotation任务" + new Date());
        }
    }
}
